/* eslint-disable */
import request from '@/utils/request'

/************************ 经销商列表 ************************/
// 获取经销商等级
export function getDistributorLevel(params) {
  return request({
    url: '/dealer/grade/list',
    method: 'GET',
    params
  })
}
// 经销商列表
export function getDistributorList(params) {
  return request({
    url: '/dealer/list',
    method: 'GET',
    params
  })
}
// 经销商详情
export function getDistributorDetail(params) {
  return request({
    url: `/dealer/${params.id}/show`,
    method: 'GET',
    params
  })
}
// 添加经销商
export function addDistributor(data) {
  return request({
    url: '/dealer',
    method: 'POST',
    data
  })
}
// 获取经销商信息
export function getDistributorInfo(params) {
  return request({
    url: `/dealer/${params.dealerId}`,
    method: 'GET',
    params
  })
}
// 更新经销商信息
export function putDistributorInfo(data) {
  return request({
    url: `dealer/${data.dealerId}`,
    method: 'PUT',
    data
  })
}
// 调整余额
export function balanceDistributorInfo(data) {
  return request({
    url: `/dealer/${data.dealerId}/balance`,
    method: 'POST',
    data
  })
}
// 取消经销商
export function cancelDistributorInfo(data) {
  return request({
    url: `/dealer/${data.dealerId}/cancel`,
    method: 'POST',
    data
  })
}

/************************ 经销商设置 ************************/
// 获取经销商配置
export function getDistributorDealer(params) {
  return request({
    url: '/shop/dealer',
    method: 'GET',
    params
  })
}
// 开启经销商功能
export function postDistributorDealer(data) {
  return request({
    url: '/shop/dealer',
    method: 'POST',
    data
  })
}
// 关闭经销商功能
export function putDistributorDealer(data) {
  return request({
    url: '/shop/dealer',
    method: 'PUT',
    data
  })
}
// 开启经销商逐级设置功能
export function postDistributorGradually(data) {
  return request({
    url: '/shop/dealer/gradually',
    method: 'POST',
    data
  })
}
// 关闭经销商逐级设置功能
export function putDistributorGradually(data) {
  return request({
    url: '/shop/dealer/gradually',
    method: 'PUT',
    data
  })
}
// 修改经销商等级信息
export function modifyDistributorGradually(data) {
  return request({
    url: `/shop/dealer/gradually/${data.gradeId}`,
    method: 'POST',
    data
  })
}
// 获取经销商统计
export function dataDistributorGradually(params) {
  return request({
    url: `/dealer/${params.dealerId}/data`,
    method: 'GET',
    params
  })
}

/************************ 经销商详情 ************************/
// 经销商详情 -- 佣金变动记录
export function getDistributorRewardList(params) {
  return request({
    url: `/dealer/${params.id}/rewardList`,
    method: 'GET',
    params
  })
}
// 经销商详情 -- 余额变动记录
export function getDistributorBalanceList(params) {
  return request({
    url: `/dealer/${params.id}/balanceList`,
    method: 'GET',
    params
  })
}
// 经销商详情 -- 订单列表
export function getDistributorTradeList(params) {
  return request({
    url: `/dealer/${params.id}/tradeList`,
    method: 'GET',
    params
  })
}
// 经销商详情 -- 入库单列表
export function getDistributorStockInList(params) {
  return request({
    url: `/dealer/${params.id}/stockInList`,
    method: 'GET',
    params
  })
}
// 经销商详情 -- 出库单列表
export function getDistributorStockOutList(params) {
  return request({
    url: `/dealer/${params.id}/stockOutList`,
    method: 'GET',
    params
  })
}
// 经销商详情 -- 直属下级列表
export function getDistributorDirectlyList(params) {
  return request({
    url: `/dealer/${params.id}/directlyList`,
    method: 'GET',
    params
  })
}
